import { createRouter, createWebHashHistory } from "vue-router";

const IndexComponent = () => import("../views/home");
const oneCategory = () => import("../views/category/oneCategory");
const twoCategory = () => import("../views/category/twoCategory");
const GoodsDetailPage = () => import("../views/goods/GoodsDetailPage");
const LoginPage = () => import("../views/login/LoginPage");

const routes = [
  {
    path: "/",
    component: IndexComponent,
  },
  {
    path: "/category/:id",
    component: oneCategory,
  },
  {
    path: "/category/sub/:id",
    component: twoCategory,
  },
  {
    path: "/goods/:id",
    component: GoodsDetailPage,
  },
  {
    path: "/login",
    component: LoginPage,
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior: () => ({ top: 0 }),
});

export default router;
